package com.lwl.modules.job.task;

import com.lwl.common.utils.ShiroUtils;
import com.lwl.modules.sys.entity.SysUserEntity;
import com.lwl.modules.sys.service.SysUserService;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2017/7/25.
 */
@Component("lwlTask")
public class LwlTask {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private SysUserService sysUserService;

    public void run(String params){
        logger.info("自定义任务调度方法，参数为：" + params);

        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        SysUserEntity user = sysUserService.queryObject(ShiroUtils.getUserEntity().getUserId(),ShiroUtils.getUserEntity().getTenantId());
        System.out.println(ToStringBuilder.reflectionToString(user));
    }
}
